import http from "../utils/request";

/**
 *  查询部门列表
 * @param {*} params
 * @returns
 */
export async function getDepartmentListApi(params) {
  return await http.get("/api/department/list", params);
}

/**
 *  获取所属部门列表
 * @returns
 */
export const getParentTreeList = async () => {
  return await http.get("/api/department/parent/list");
};

/**
 *  新增部门接口
 * @param {*} params
 * @returns
 */
export const addDeptApi = async (params) => {
  return await http.post("/api/department/add", params);
};

/**
 *  编辑部门接口
 * @param {*} params
 * @returns
 */
export const editDeptApi = async (params) => {
  return await http.put("/api/department/update", params);
};

/**
 * 检查该部门下是否还有子部门
 * @param {*} params
 * @returns
 */
export const checkDepartmentApi = async (params) => {
  return await http.getRestApi("/api/department/check", params);
};

/**
 *  根据部门id删除部门
 * @param {*} params
 * @returns
 */
export const deleteByIdApi = async (params) => {
  return await http.delete("/api/department/delete", params);
};
